Analogies between electron and photon tunneling