When one train was struck by lightning and lost power, another crashed into it from behind - derailing several cars.