What is the story about farm animals who stand on top of each other?

You're probably thinking of the classic children's book "Corduroy" by Don Freeman.

While it doesn't feature farm animals specifically, it does have a very similar concept. In the story, a little teddy bear named Corduroy wants to be the perfect gift for a little girl. But he's missing a button and feels incomplete. To reach a high shelf in the toy department where there are extra buttons, Corduroy gets help from a stack of other stuffed animals:

* A giraffe stands tall and lets Corduroy climb onto his back.

* A hippo lies down and Corduroy climbs onto his head.

* A penguin stands on the hippo and Corduroy climbs onto the penguin.

Finally, Corduroy is able to reach the shelf and find his button. He is now complete and ready to be the perfect gift.

While not exactly farm animals, the idea of animals stacking on top of each other to reach something is very similar.

Is there anything else you can remember about the story you are thinking of? Maybe some more details about the animals involved or the setting?