Why is this compound more basic than the other?

So, the original question was which compound is more basic.

Compound A and Compound B respectively.

My reasoning is that on protonation, Compound B would be more stable than Compound A as well, Compound B is an allylic nitrogen cation. Thus, compound B should be more basic.

Why don't nitrogen cations act similar to carbo cations in this case?

But the given answer is that compound A is more basic, because of being connected to a sp2 hybridized carbon. Another given reason was that the first cation was stabilized by water while the second one wasn't?

Where am I wrong?

• Being connected to a sp2 hybridised carbon makes it weaker not stronger. Still, enamines can be even weaker because of mesomeric effects. Sep 2 at 15:24
• @Mithoron, I know right! I was like, that sp2 reasoning doesn't make much sense. Sep 2 at 15:30
• The lone pair in B is conjugated with the C=C bond. Similar to the nitrogen lone pair in an amide, which is also not very basic Sep 2 at 19:55

What may be happening is that the A cation has a resonance structure where the $$\pi$$ bond polarizes to the nitrogen and thus turns the $$sp^2$$ carbon into a carbocation center (leaving the nitrogen formally uncharged). This carbocation contribution is enhanced by the $$sp^2$$ carbon also hyperconjugating with the carbon atom next to it in the ring. Also the B cation cannot form an allylic structure because protonation of the nitrogen atom in that compound saturates it.