Select the correct alternative from the given choices.
The ratio of the number of students in classes $A, B$ and $C$ is $3: 7: 8$. If 10 students leave $C$ and join $B$, the ratio of the number of students in $B$ and $C$ would be reversed. Find the total number of students in the classes $A, B$ and $C$.
(A) 144
(B) 162
(C) 180
(D) 198