However in real cases the resistance is connected in a circuit.
In this case the measurement of the resistance cannot be correct due to circuit context.

As a matter of fact, part of the current, provided by the generator, instead of flowing in the resistance  (Rx in the example) is derived from the components connected to the input node (R1 and R2 in the example). 

Therefore it is necessary to avoid the passage of the current through the resistances R1 and R2.

For this purpose, a unit gain voltage amplifier is used, called guarding amplifier.

This amplifier, inserted as shown in figure, imposes that the potential difference at the terminals of R1 and R2 is null; consequently, also the respective currents are cancelled. 

This type of measurement forces the current to entirely flow in the component under test.

In this way, measurement errors are eliminated due to the shunting of the current by the components on the same input node of the component under test.