Checking array against author id in loop

You actually want author__in, and you can use the array. You shouldn’t implode it:

$query = new WP_Query( 
  array( 
    'author__in' => $friendsIdArray 
  )
);

As far as where in the Loop this goes, I’m not sure I understand. This occurs before creating your a Loop, not in it.