I'm studying the classic results on binary (integer) quadratic forms and I'm looking for a reference on the following result (maybe a book that contains a proof):
Let $O_k$ be the ring of algebraic integers of $Q(\sqrt{d})$. In the set of ideals of $O_k$, we define the equivalence relation $I \sim J \Leftrightarrow \exists a,b : (a)I=(b)J$ where $(a)$ is the ideal generated by $a$. Then, the equivalence classes of $\sim$ form a group $G$ with the usual multiplication of ideals. Furthermore, $|G|=h(d)$, where $h(d)$ is the class number.
The definition I've read for $h(d)$ is the number of equivalence classes of quadratic forms with discriminant $d$ for the equivalence relation $f \sim g \Leftrightarrow f(x,y)=g(px+qy,rx+sy)$ with $ps-qr=1$.
If someone could give me a good reference in this nice connection I would be really grateful.