When a power-driven vessel overtakes another power-driven vessel, it is the vessel being overtaken that is the stand-on vessel and has the right of way.
So, if you are the overtaking vessel, Vessel A in this example, then you are the give-way vessel and must take early and substantial action to stay out of the way of Vessel B as you pass around it.
The same rule applies to sailing vessels. Sailing vessels should stand-on when being overtaken and give-way when overtaking.
If both vessels are power-driven, you must also use sound signals. If you want to pass on the starboardright hand side of a vessel. side, give one short blast before altering your course.If you want to pass on the portleft hand side of a vessel. side, give two short blasts. The operator of the boat being overtaken will then return the same signal to indicate understanding of where you are going.