  Let $K$ be an imaginary quadratic field of discriminant $d_K$, and let
$\mathfrak{n}$ be a nontrivial integral ideal of $K$ in which $N$ is the
smallest positive integer. Let $\mathcal{Q}_N(d_K)$ be the set of primitive
positive definite binary quadratic forms of discriminant $d_K$ whose leading
coefficients are relatively prime to $N$. We adopt an equivalence relation
$\sim_\mathfrak{n}$ on $\mathcal{Q}_N(d_K)$ so that the set of equivalence
classes $\mathcal{Q}_N(d_K)/\sim_\mathfrak{n}$ can be regarded as a group
isomorphic to the ray class group of $K$ modulo $\mathfrak{n}$. We further
present an explicit isomorphism of $\mathcal{Q}_N(d_K)/\sim_\mathfrak{n}$ onto
$\mathrm{Gal}(K_\mathfrak{n}/K)$ in terms of Fricke invariants, where
$K_\mathfrak{n}$ is the ray class field of $K$ modulo $\mathfrak{n}$. This
would be certain extension of the classical composition theory of binary
quadratic forms, originated and developed by Gauss and Dirichlet.
