Precise localization is critical to safety for connected and automated vehicles (CAV). The global navigation satellite system is the most common vehicle positioning method and has been widely studied to improve localization accuracy. In addition to single-vehicle localization, some recently developed CAV applications require accurate measurement of the inter-vehicle distance (IVD). Thus, this paper proposes a cooperative localization framework that shares the absolute position or pseudorange by using V2X communication devices to estimate the IVD. Four IVD estimation methods are presented: Absolute Position Differencing (APD), Pseudorange Differencing (PD), Single Differencing (SD) and Double Differencing (DD). Several static and dynamic experiments are conducted to evaluate and compare their measurement accuracy. The results show that the proposed methods may have different performances under different conditions. The DD shows the superior performance among the four methods if the uncorrelated errors are small or negligible (static experiment or dynamic experiment with open-sky conditions). When multi-path errors emerge due to the blocked GPS signal, the PD method using the original pseudorange is more effective because the uncorrelated errors cannot be eliminated by the differential technique.