You can't, at least not directly. That would be a nasty security risk.
While you can specify a Domain attribute, the specification says "The user agent will reject cookies unless the Domain attribute specifies a scope for the cookie that would include the origin server."
Since the origin server is a.com
and that does not include b.com
, it can't be set.
You would need to get b.com
to set the cookie instead. You could do this via (for example) HTTP redirects to b.com
and back.