# Are finite groups with same conjugacy classes isomorphic

Suppose $G_1$ and $G_2$ are finite groups with the same number of conjugacy classes and the same number of elements in each conjugacy class. I can construct a map $\phi:G_1\to G_2$ which sends some conjugacy class in $G_1$ to a corresponding class in $G_2$. I am not sure how to prove $\phi$ is an isomorphism since the groups might have different structure with respect to multiplication.

I am not sure if such a map exists since I think it would take the form $\phi(A)=gAg^{-1}$, for some conjugacy class $A$ in $G_1$, implying that $G_1\subset G_2$. Are these groups isomorphic?