An effective Coulomb interaction in nuclear energy density functionals