Using holomorphic projection, we work out a parametrization for all relations of products (resp. Rankin–Cohen brackets) of weight mock modular forms with holomorphic shadow and weight modular forms in the spirit of the Kronecker–Hurwitz class number relations. In particular we obtain new proofs for several class number relations among which some are classical, others are relatively new. We also obtain similar results for the mock theta functions.