A travels 2.5 * 4.5 = 11.25 miles before B starts. The distance B has to cover to overtake A is 11.25 miles.
B overtakes A at the difference of their speeds: 7-4.5=2.5 MPH.
11.25 = 2.5*t so t = 11.25/2.5 = 4.5 hours.