The basic reproduction number of an infection in a given population, R0, is inflated by individual heterogeneity in contact rates. Recently, new methods for estimating R0 using social contact data and serological survey data have been proposed. These methods, like most of their predecessors, ignore individual heterogeneity, and are sensitive to perturbation of the contact function. Using a frailty framework, we derive expressions for R0 in the presence of age-varying heterogeneity. In this case, R0 is the spectral radius of a population version of the next generation operator, which involves the variance function of the age-dependent frailty. This variance can be estimated within a shared frailty framework from paired data on two infections transmitted by the same route. We propose two estimators of R0 for infections in endemic equilibrium. We investigate their performance by simulation, and find that one is generally less efficient but more robust than the other to perturbation of the effective contact function. These methods are applied to data on varicella zoster virus infection from two European countries.