The trains cannot overtake each other. Same as trolley buses.
Trolley buses can overtake each other. Emergency - almost everywhere, and in some cities (Simferopol) they do this regularly on schedule. The outgoing tramways for 25 years have not been seen, but the city electric cars outgo each other quite commonly, for example, in Tokyo. Depends on the topology of the network.