Let the present ages of A and B be $5x$ and $3x$ respectively, according to the given ratio $5:3$.
After 5 years, their ages will be $(5x + 5)$ and $(3x + 5)$.
The problem states that the ratio of their ages after 5 years will be $10:7$. Therefore, we can set up the equation:
$ \frac{5x + 5}{3x + 5} = \frac{10}{7} $Cross-multiply to solve the equation:
$7(5x + 5) = 10(3x + 5)$
$35x + 35 = 30x + 50$
$35x - 30x = 50 - 35$
$5x = 15$
$x = \frac{15}{5}$
$x = 3$
Now, find the present ages:
The difference between their present ages is:
Difference = A's age - B's age = $15 - 9 = 6$ years.