Votes on a post should be contingent only on your personal assessment of its own merits. They should not be contingent on any of the following:
- The post author or other users
- Other posts (e.g. downvoting an answer because the question is off-topic or because the author left an objectionable comment under their own answer or anyone else's)
- Other votes (e.g. I'll upvote you if and only if you upvote me)
- Actions promised but not yet fulfilled (e.g. asking for votes in exchange for a new answer or an edit to an existing answer)
While we can't enforce how anyone uses every one of their votes because individual votes are anonymous and we can't police anyone's free will, we do have rules, boundaries and mechanisms in place to maintain a more-or-less level playing field.
Having said that, withholding an answer or new information in an answer in exchange for your upvote is insidious because it hurts not only you, but also any future readers viewing the question. To make it simply about any one particular reader and their vote is selfish and goes against the spirit of Stack Overflow as a Q&A knowledgebase for all. In the long run, it also hurts the answerer because they're giving up any potential future upvotes they could've received had they just shared the knowledge, just because of one upvote (that they have no way of verifying was from you to begin with).
So when someone tells you in a comment that they'll edit their answer to add new information if and only if you upvote it first, how do you respond? Well, you could flag it and forget about it, if the user doesn't seem like they'd be amenable to reason.
Otherwise, you could try asserting in a reply that it's not appropriate to ask for votes in exchange for new information in an answer. Or you could just link to this answer. If they refuse to budge, well, as petty as this may sound you reserve the right to downvote the answer if it's simply detrimental or not useful to you the way it is. But also don't feel compelled to vote if you simply don't wish to deal with any potential consequences. Just move on in that case.
In this specific situation, user B is innocent. However, the fact that a third party has an idea of what the better solution is indicates that there's still hope that someone else might come along and share it. I do recommend the approach in D. SM's answer of asking a new question — it is OK to ask follow-up questions branching off of existing, answered ones, with links for context (though do be careful, questions about improving on existing, working solutions tend to go on Code Review Stack Exchange instead). If user A refuses to share, it's their loss.
If someone is engaging in a pattern of demanding votes from other users this way, flag their answer for moderator attention and we'll speak to them. This is definitely not behavior we want to encourage on Stack Overflow, for the reasons I explained above.
We don't want to encourage anyone to upvote first in such a situation either, because there's a chance the user may not honor their end of the bargain. And if you don't retract your upvote within five minutes, it gets locked in until either the post author finally makes good and edits their answer, or you raise a flag and a moderator makes a stub edit to free your vote (or you come here making a stink about it and someone with the right privileges does so). Abuse potential aside, the vote you deposited doesn't reflect your opinion of the post in its actual state, and getting it removed is just unnecessary hassle for everyone but the answerer.