If something does not compile, then compiler tells the points that confuse it:
In function 'void setValue(Animal&, int)':
19:5: error: 'friend' used outside of class
13:9: error: 'int Animal::itsWeight' is private
20:15: error: within this context
In function 'int main()':
26:1: error: expected initializer before 'setValue'
What did those say?
1. Nothing can be a friend of a function. Functions and classes can be a friend of a class. The setValue() could/should be a member of Animal.
2. Without friendship the line 20 is access violation.
3. What is the last character of line 25? That shows as error on line 26.
You have to learn to decipher the compiler's messages.