The issue here is not about "past perfect continuous". What you have in "past perfect continuous" is good.
It is about the preposition "for". The preposition "for" has different meanings based on context.
If the phrase that follows "for" could be a complete sentence (a subject and a conjugated verb, "a friend arrived"), then "for" means "because". This is an uncommon usage and it would usually be better to use "because" instead of "for".
"Both Samantha and Sarah had been waiting all day because a friend arrived."
If you do not want "for" to mean "because", then what follows "for" should be some kind of noun phrase (no conjugated verb, "for a friend").
Alone, "a friend" is a simple noun phrase, but a complex noun phrase might also include an action or event.
To express an event or action as part of a noun phrase, the would-be subject is followed by the verb in some non-conjugated form (preceded by "to", or ending with "ing").
The difference between "waiting for a friend to arrive" and "waiting for a friend arriving" is small. I think "to arrive" would be more common.