Transfer of entanglement from electrons to photons by optical selection rules