How do you think someone else knows?
I mean, there aren't many solutions: you know either by reading the code or by trying it and seeing if it works.
Trying it is easy and requires no understanding other than knowledge of the console.log script call.
Boot up the console, get your target object, and see if the friendsUnit call works.
Hell, do a console.log inside the target eval to know it. Quick, easy, 5 seconds to test in battleTest and you'll have your answer. That's the easy way: It gets you no knowledge about the general case. It justs gets the job done, quick and dirty.
The hard way is by reading the code, and understanding the context of the function call.
Friends unit can be found in the game action class. In there you can see it calls subject.friendsUnit(), that means friendsUnit is actually a function from the subject itself. Subject will either be an actor or enemy object so you go look into there.
Lo and behold, friendsUnit returns $gameParty for instances of game actor, and $gameTroop for instances of game_enemy.
There you have it. You can use friendsUnit on actors or enemies and you know what it will return.
It took me a grand time of 10 seconds searching rpg_objects to find this. As easy as ctrl-f and pasting friendsUnit. Hell, it took me longer to type this than to find this info.
Using script calls without understanding why they work is just a recipe for disaster, and an exercise in frustration. Do yourself a favor, and search the core files before writing a script call, just so you know what you're actually doing.
I'd actually advise also a quick search of relevant plugins you use to see if they're not modifying the behavior of the core scripts for that particular function. This is done easily by using the console.log script call and telling it to return to you the actual function (by omitting the brackets and parameters), it will then tell you in which file, and which line to look, so you can understand what you're dealing with.