I wonder how this could work when Whatsapp advertises that conversations are encrypted end-to-end.
There's also the option that before bringing up something in conversation, your friend has made some related searches or reacted to a related ad. Facebook could then make the decision to show the ad to you based on your friend past behavior and the fact that you two had a conversation.
This is similar to the Cocktail Party Effect