As Ron Maupin says, this is generally a misconfiguration (or occasionally a transition situation.)
If as you describe A thinks B is a neighbour but B thinks A is not a neighbour, and they are connected (by switch, say) there are a number of cases related to how they have ARP implemented. Understanding what will happen is very useful for debugging if you find yourself with such a mismatched configuration. Be conscious that embedded device IP implementations are not of the same quality as major router and host OS implementations.
The ARP RFC 826 was published when classful addressing was the norm (1982), long before CIDR was introduced by RFC 1519 (1993). As such, it doesn't cover the case of two hosts on the same network with different netmasks, even though subnetting was common then. It's clear that the requestor shouldn't make requests for IP addresses outside its range (though some OS have certainly done this). But what should a host do if it receives an ARP request from an IP address outside its own network (as defined by receiver's netmask)? This is not covered by the ARP RFC nor the subsequent host requirements RFCs.
Tests with current Cisco and Ubuntu show they do not answer ARP from outside the receiver's network. But it's surely possible that some OS are still "sloppy" and answer the ARP request without looking at the local netmask. (Indeed, some OS might update B's ARP table and thus make B think A is local despite what the netmask says.)
- If A has no existing ARP entry for B, it will send an ARP request
- B receives the ARP request
- If B is "strict" it will ignore the request; if "sloppy" it will send ARP reply
- A will probably retry if it expects ARP reply but doesn't get one
- If A (now) has an ARP entry for B
- A will send IP packet to B
- B receives packet
- If B has suitable local router R, will send reply to R
Tests can be made with a static ARP entry for B on A.
I'm generally ignoring proxy ARP, as it just transforms the question into "If A thinks P is a neighbour but P thinks A is not a neighbour."