4n35 Optocoupler as Switch

If you go with the 12 volt version of the relay, you can drive it directly from two esp8266 outputs and the power is supplied by the vehicle.

All that aside, if the device you’re powering is on when the esp8266 is on, you can create a high side switch with p channel mosfet which would eliminate the need for the rather expensive relay. That’s just a guess though as you’ve never explained what you’re doing with the 8266 and the device being controlled by the relay.