Quadratic twists of elliptic curves and class numbers