The scaling relations between global asteroseismic observables and stellar properties are widely used to estimate masses and radii of stars exhibiting solar-like oscillations. Since the mass and radius of the Sun are known independently, the Sun is commonly used as a reference to scale to. However, the validity of the scaling relations depends on the homology between the star under study and the reference star. Solar-like oscillators span a wide range of masses and metallicities, as well as evolutionary phases. Most of these stars are therefore not homologous to the Sun. This leads to errors of up to 10% (5%) in mass (radius) when using the asteroseismic scaling relations with the Sun as the reference. In this paper we derive a reference function to replace the solar-reference value used in the large-frequency-separation scaling relation. Our function is the first that depends on both effective temperature and metallicity, and is applicable from the end of the main sequence to just above the bump on the red giant branch. This reference function improves the estimates of masses and radii determined through scaling relations by a factor of 2, i.e. allows masses and radii to be recovered with an accuracy of 5% and 2%, respectively.