In an electrically neutral ATOM, the number of electrons equals the number of protons.
However, an ION is an atom (or group of atoms) which has either gained or lost some electrons, so for an ION the number of electrons does not equal the number of protons.
This excellent Tyler de Witt video explains this clearly: