In 1971, Davenport and Heilbronn determined the mean number of 3-torsion elements in the class groups of quadratic fields, when ordered by discriminant. I will describe some aspects of the proof of Davenport and Heilbronn’s theorem; in particular, they prove a relationship via class field theory between the number of 3-torsion ideal classes of quadratic fields and the number of nowhere totally ramified cubic fields over Q. This argument generalizes to give a relationship between 3-torsion elements of the ray class groups of quadratic fields and certain pairs of cubic fields satisfying explicit ramification conditions. I will illustrate how the combination of this fact with Davenport-Heilbronn’s asymptotics on the number of cubic fields of bounded discriminant allows one to compute the mean number of 3-torsion elements in ray class groups of quadratic fields. If time permits, I will discuss the analogous theorems computing the mean size of 2-torsion elements in ray class groups of cubic fields ordered by discriminant, generalizing Bhargava.