Note that just before overtaking, train 'A' is having the same distance as the car that chased it.
remember that v = d/t or d = vt
where v is the velocity or speed
d is the distance
t is the time
for the train you'll have the distance as:
d = vt
take note that the train traveled (@7am) 1 hour ahead so,
d = 40(t +1)
d = 40t + 40 ----equation 1
for the distance traveled by the car you'll have
d = vt
d = 80t ---equation 2
remember that both the train and the car traveled the same distance from the station so you can equate the distance(equation 1 and 2) and you'll have it as:
40t + 40 = 80t
40 = 80t - 40t
40 = 40t
t = 1hour
since the time is 1 hour, then it is 1 hour after the car leaves the station.
remember that the car leaves the station 1 hour after the train left. so the car left the station @8am.. since the time traveled by the car is 1hr just before overtaking, then the car overtook the train 1 hour after leaving the station or that would be 2 hours from the time the train left and it would be at 9am.