getting the direction of an object using gps

hey guys i need your help
so here is the situation
i have two objects moving (let's suppose that they are cars ) so i'm on one of the cars and i need to know the direction of the other car in front of me is it on the opposite direction or in my direction so my question is , how to know the direction of the car using a gps module ? anyone who knows the code to do that please help me

if there is no way to do it with a gps i am thinking of using a magnetometer to know directions but is it exact and stable or not ?

Given coordinates from two GPS modules, bearing() or courseTo() functions can be used to find the direction from one to the other. The functions are part of the TinyGPS++ and NeoGPS libraries.

Magnetometers usually don't work well in cars because of the nearby iron.

thank u jremington
i just did a research about the courseTo() function and i found how to do it thanks

so the magnetometer is useless for this situation