Yes, I've owned one, and worked on a few.
Usually it's a whole room, not just cupboards though.
As long as it's shown on the title deeds, it should be no problem legally.
Most important is that you make sure the neighbour is fully aware of the situation. The biggest factor, as always, is keeping good neighbourly relations.
Most possible problems concern access for repairs. That shouldn't be a concern if it's only cupboards.
The bad news is that Lenders often don't like them, and restrict the loan, or refuse them altogether.