に来られた (に + passive verb form) usually also conveys a dissatisfaction towards what happened, so in this case the visit wasn't welcome. This is very common structure in Japanese.
If you said "朝、まだ寝ている時、友達 が 来ました", this would just be a neutral "... my friend came over". and "朝、まだ寝ている時、友達 が 来られました" would have the same meaning but in this case the passive form would convey higher politeness level towards the friend. Another example of this usage would be: "先生がこられました” the teacher came"