Let $f$ be a binary quadratic form with integer coefficients and non-zero discriminant $D$. Suppose for simplicity that $D$ is a fundamental discriminant (which in particular implies that $f$ is primitive). We say that $f$ *represents a square mod* $D$ if for any $a$ representable by $f$ we have

$$a \equiv \square \pmod{p}$$

for each prime $p | D$. Note that this condition only depends on the $\text{GL}_2(\mathbb{Z})$-equivalence class of $f$. We can thus say that the $\text{GL}_2(\mathbb{Z})$-class of $f$, $[f]$, is a *square class* if for a prime $q$ representable by $f$ and co-prime to $D$ satisfies $q \equiv \square \pmod{p}$ for $p | D$, and if $D \equiv 0 \pmod{4}$ (respectively $8$), then $q \equiv 1 \pmod{4}$ (respectively $8$). By our earlier discussion, the choice of $q$ representable by $f$ does not matter.

How are 'square classes' distributed in the ideal class group of $\mathcal{O} = \mathcal{O}_{\mathbb{Q}(\sqrt{D})}$? Heuristically, for each (odd) prime $p | D$, half of the classes of the ideal class group should be square mod $p$ and the other half should not, so the number of square classes ought to be $h_2(D) 2^{-\omega(D)}$ where $h_2(D)$ is the class number of $\mathcal{O}$ and $\omega(n)$ denotes the number of prime divisors of $n$.