Sacrifice yourself. You can turn it towards your friend, hop off and push the friend off the track. You may not have time to hop off the tracks. And here I am assuming the the trolley has no brakes. Also, it may be possible to hop the tracks and most likely die yourself.