Search for strong electric fields in PbPb collisions at $\sqrt{s_\mathrm{NN}} =$ 5.02 TeV using azimuthal anisotropy of prompt $\mathrm{D}^0$ and $\overline{\mathrm{D}}^0$ mesons