Adding a sequence number
The solution to this problem is to use the SEQ field in the frame header to store a sequence number and allow B to differentiate between incoming frames
When A sends a frame to B it sets this field to the current sequence number, sends the frame, and waits for acknowledgement
On receipt of an acknowledgement A increments SEQ in a circular fashion (i.e. (SEQ+1) mod MAX_SEQ)
On receipt of the data frame, B checks for the correct sequence number and sends an acknowledgement