Generalized Euler and class numbers