。
A friend asked me to send them a postcard.
Literal
Friend [subject-が] postcard [object-を] give [purpose-ように] me [target-に] asked.
くれる here reflects the requester's perspective embedded inside ように頼む — the friend is asking 'give me a postcard.' In indirect requests with ように頼む, the embedded verb retains the viewpoint of the person making the request, which is why くれる appears even though the narrator would be the one giving.