Not sure what you mean by electrical analogy. An XOR gate is an Exclusive OR, and can be considered a programmable inverter. A high on one input (of two) makes the output equal to the inverse of the other input. The equation for an XOR is C = A(Bbar) + B(Abar). This can be realized with an OR gate for the '+' and two - 2 input AND gates, one input having an inverter in it. It can also be written (Cbar) = ((A+(Bbar) bar) . ((B+(Abar)) bar) which can be realized with NOR and NAND gates (universal logic))
An XNOR is an Exclusive NOR, which has the same action as the XOR, except its output is inverted with respect to the XOR.