How the Beggar Boy turned into Count Piro is an Italian fairy tale collected by Laura Gonzenbach in Sicilianische Märchen. Andrew Lang included it in The Crimson Fairy Book.
It is Aarne-Thompson type 545B, the Cat as Helper. Other tales of this type include Don Joseph Pear, Puss in Boots, and Lord Peter.
A beggar boy's father left his son a pear tree that bore pears year round. One day, a fox persuaded the boy to give it the pears, because it would bring him luck, and the kind-hearted boy did. The fox brought the basket to the king, who was astounded that anyone had pears that time of year. The next day, it did the same, and asked for the princess's hand in marriage for his master, Count Piro, saying his master was so rich he would ask for no dowry. The fox tricked a tailor into providing him a fine suit, saying it would be paid for the next day.
The boy went to the castle and said very little, but the fox explained it was his great concerns that kept him quiet.
Then the fox took a third basket of pears and arranged for the wedding. Once they were married, the king and princess set out with the boy. The fox told a shepherd for an ogre that if he told the men that the sheep belonged to an ogre, the men would kill the sheep, and the ogre would kill him; he should say they belonged to Count Piro. It did the same with a pigherd and a horseherd. The king was impressed by the wealth.
At the ogre's castle, the fox told the ogre and ogress that the king had sent men to kill them, and it was best to hide in the oven until they passed. It trapped them in, and after the princess and her bridegroom were abed, the fox burned the ogre and ogress to death.
The beggar boy lived out his life in wealth and prosperity, and when the fox died, he held him a proper funeral.
The Fox & Beggar Theater is a circus troop based in Asheville, NC. They have mentioned this story as inspiration for the troop, citing the fox's wild creativity and the boy's kind heart as the perfect pairing to achieve incredible goals.