Class polynomials for nonholomorphic modular functions