Why is this compound more basic than the other?

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


[![Compound A](https://i.stack.imgur.com/N5xNA.png)](https://i.stack.imgur.com/N5xNA.png)
[![Compound B](https://i.stack.imgur.com/CSQ0z.png)](https://i.stack.imgur.com/CSQ0z.png)


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.


[![enter image description here](https://i.stack.imgur.com/MRdVt.png)](https://i.stack.imgur.com/MRdVt.png)[![enter image description here](https://i.stack.imgur.com/uatIL.png)](https://i.stack.imgur.com/uatIL.png)


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?




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.


 3

The A ammonium ion is sp2 hybridized so less basic[really the ion is more acidic] than an sp3 nitrogen. However, the enamine structure in B delocalizes the electron pair over the nitrogen and the double bound reducing basicity even more. There is no resonance of an ammonium ion with a double bond; there are no orbitals available on the nitrogen to accept electrons to reduce the charge[except antibonding].


 1