Sharing information between two mutually uninvolved collaborators
I would simply ask A. Say "this project has been fun, but I assume you don't want to continue to work on it for reasons X, Y, and Z. Do you have any objection to me continuing the work after this paper is published." You don't need to wait for this to be published, I see nothing wrong with saying this while writing the paper or even while concluding the research.

If they say that they don't mind, great. You don't need to tell them about he other person you will later bring in.

If they say they do mind, find out why and address their concerns.

The third option is that they surprise you and say "actually, I want to keep working on this." In that case I wouldn't try to push them out. Instead I would continue the research with them and at some point later suggest bringing B onboard as an additional collaborator.

You can inform B of the contents of the project as soon as you bring them onboard or as soon as you have a public preprint, whichever is earlier. Alternatively, you could also ask if A has any objections to you sending the paper around to a few people and send it to B.