The newly launched Ioniq EV car by Hyundai will have a V2L or Voltage-to-Load function that can enable charging other electrical appliances including other EV cars.
Next time this thing happen no need to derail a train just get an EV or a PHEV that can be a handy as a mobile and powerful power generator. For PHEV you can even use petrol or diesel to generate the electricity.