Classical Cepheids (CCs) are at the heart of the empirical extragalactic distance ladder. Milky Way CCs are the only stars of this class accessible to trigonometric parallax measurements. Until recently, the most accurate trigonometric parallaxes of Milky Way CCs were the HST/FGS measurements collected by Benedict et al. (2002, 2007) and HST/WFC3 measurements by Riess et al. (2018). Unfortunately, the second Gaia data release (GDR2) has not yet delivered reliable parallaxes for Galactic CCs, failing to replace the HST as the foundation of the Galactic calibrations of the Leavitt law. We aim at calibrating independently the Leavitt law of Milky Way CCs based on the GDR2 catalog of trigonometric parallaxes. As a proxy for the parallaxes of a sample of 23 Galactic CCs, we adopt the GDR2 parallaxes of their spatially resolved companions. As the latter are unsaturated, photometrically stable stars, this novel approach allows us to bypass the GDR2 bias on the parallax of the CCs that is induced by saturation and variability. We present new Galactic calibrations of the Leavitt law in the J, H, K, V, Wesenheit WH and Wesenheit WVK bands based on the GDR2 parallaxes of the CC companions. We show that the adopted value of the zero point of the GDR2 parallaxes, within a reasonable range, has a limited impact on our Leavitt law calibration.