There are various phrases for this: "catty remark", "snide aspersion", "barbed remark", "subtle dig", etc. None of these indicate the other person is in earshot, but you can include that information in the sentence:
While talking to her friend, Dana snidely insulted Hanna's character, after making sure Hanna was close enough to overhear.