Nucleon and pion electromagnetic form factors in a light-front constituent quark model