The theory of complex multiplication gives a very satisfactory method for constructing abelian extensions of imaginary quadratic fields, by means of the j-invariant attached to certain CM elliptic curves, and some related invariants.
After recalling the main results of this beautiful theory, I will discuss recent joint work with Henri Darmon on a new approach for real quadratic fields. The theory of indefinite quadratic forms will be approached via the Conway topograph and the Bruhat-Tits tree, and the combination of this archimedean and non-archimedean perspective leads to the definition of certain rigid meromorphic cocycles which give us a real quadratic analogues of singular moduli.