Let the common ratio between the number of boys and numbers of girls be x.

Number of boys = 7x

Number of girls = 5x

According to the given question,

Number of boys = Number of girls + 8

∴ 7x = 5x + 8

On transposing 5x to L.H.S, we obtain

7x − 5x = 8

2x = 8

On dividing both sides by 2, we obtain

2x/2x = 8/2

x = 4

Number of boys = 7x = 7 × 4 = 28

Number of girls = 5x = 5 × 4 = 20

Hence, total class strength = 28 + 20 = 48 students