Let K be an imaginary quadratic field of discriminant , and let be a nontrivial integral ideal of K in which N is the smallest positive integer. Let be the set of primitive positive definite binary quadratic forms of discriminant whose leading coefficients are relatively prime to N. We adopt an equivalence relation on so that the set of equivalence classes can be regarded as a group isomorphic to the ray class group of K modulo . We further establish an explicit isomorphism of onto in terms of Fricke invariants, where denotes the ray class field of K modulo . This would be a certain extension of the classical composition theory of binary quadratic forms, originated and developed by Gauss and Dirichlet.