It allows you to “pet” any animal you find – no matter, if it belongs to you, anyone else or to nobody.
In order to do that, you can simply right click it, while holding nothing in your hand. To make your pet sit or stand up, hold anything else in your hand (e.g. hold anything in your hand but raw fish to make your tamed cat sit down).
After petting an animal, hearts will appear above it and it will make a living sound (a cat will meow or purr) showing its love!