Great question! Car insurance will cover electrical fires, as long as you have a policy that covers them. Comprehensive coverage covers your vehicle for things that are outside your control like theft, vandalism, or electrical fires.
It might be that your friend only had collision coverage on his vehicle, so the electrical fire wasn’t covered by his insurance company. To avoid this, talk to your insurance adjuster about comprehensive coverage. Be sure to ask about everything your company’s comprehensive coverage includes, since coverage may differ between companies or incur extra charges.