Let the total number of pupils in the class be represented by \( T \).
According to the problem, \( \frac{3}{8} \) of the pupils are girls, which means that the remaining pupils are boys. Therefore, the fraction of boys in the class is:
\[ 1 - \frac{3}{8} = \frac{5}{8} \]
Since there are 25 boys, we can set up the equation:
\[ \frac{5}{8} T = 25 \]
To find \( T \), we can multiply both sides of the equation by \( \frac{8}{5} \):
\[ T = 25 \times \frac{8}{5} \]
Calculating the right side:
\[ T = 25 \times 1.6 = 40 \]
Thus, the total number of pupils in the class is \( \boxed{40} \).