Binary quadratic forms over Z and class numbers of quadratic fields.
What is the relation between the classification of binary quadratic forms over $\mathbb Z$, and the problem of finding the class numbers of quadratic fields?
What would be a nice reference for this?
For a very beautiful, modern, and general treatment, see this paper of Melanie Matchett Wood. The classical comparison is explained at the beginning of the paper, and then it goes on to develop very general results. I think it is a very beautiful treatment of the subject; even the classical statements are made much clearer than is usual (in my experience) in more traditional treatments.
My favourite reference on this subject would be the excellent treatment contained in the book "Primes of the form $x^2+ny^2$ by D. A. Cox - see here
He gives a lot of details of the historical background (going back to Fermat and Euler) to both binary quadratic forms and the class number problem for quadratic fields. It is not really a textbook, but is very readable with many interesting exercises, and a huge collection of references for further study.
Along with Cox, I like Duncan Buell, Binary Quadratic Forms because it does pretty much everything with integral forms, including indefinite forms and those with odd $b$ in $f(x,y) = a x^2 + b x y + c y^2.$ It gives explicit calculations for composition, particularly computer algorithms. see HERE