Car A should keep their full-beam headlights on as long as possible without blinding the driver of car B. Only when car B is coming up alongside you and has switched to full-beam headlights, should you switch to dipped headlights.