If you want to work on two branches simultaneously you should seriously think about why you have separate branches to begin with. Branches are usually there so you have separated commits that do not interfere with the other ones.
That being said you could† cherry-pick the commit on B, once it’s done on branch A. This will reapply the commit on the other branch. I.e. git cherry-pick A
to pick the top commit on A
and reapply it to the current branch.
†The problem is that it would try to add the diff, where the line print "I like cake"
is being removed which is not present on branch B, so the patch would fail and as such also the cherry-pick, resulting in a conflict. And that actually makes sense: How exactly should Git know that those two cake/banana-love lines are actually related to each other?