Two rules (more if you want to get complicated) apply in this situation: RRS 11 "On the same tack, overlapped" and RRS 17 "On the same tack, proper course".

Rule 11 (a.k.a. windward/leeward) states "When boats are on the same tack and overlapped, a windward boat shall keep clear of a leeward boat". In the given scenerio, the windward boat is required to keep clear.

Rule 17 states "If a boat clear astern becomes overlapped within two of her boatlengths to leeward... she shall not sail above her proper course...". This is a restriction on the action of the right-of-way boat. Assuming in this case, that the leeward boat established overlap from clear astern within two of HER boatlengths, she may not sail above HER proper course. If, however, leeward's (L) proper course is above windward's (W) proper course (i.e. L can point higher), then W is out of luck. She must keep clear, even if it means luffing, stalling, or tacking away.

Regards,
Eric