Car A:

Let the speed of car A be x mph, thus in 2.5 hours, the distance travelled by car A in 2.5 hours would be (x mph) x (2.5 h) = 2.5x (notice how the units cancel out, miles/hr x hr = miles)

Car B:

Say we let car B be the faster car, and so it will have a speed 30 mph faster than car A, so it's speed has to be 30+x mph. Hence the distance it travelled in 2.5 hours would be (30+x mph) x (2.5 h) = 2.5(30+x) (again, the units cancel out to miles)

We know that after two hours, the cars are 265 miles apart. Since they travelled in opposite directions, we can assume that the distance they travelled is in a straight line from one another. So the resulting equation should be:

Distance travelled by car A + distance travelled by car B = 265 miles

Then solve for x, which is the speed (rate) of car A, then substitute and find the speed for car B.

Hope this helps!