Two leading names in American dairy products are getting friendly. Dean Foods announced late Monday that it will acquire the manufacturing and retail ice cream businesses of Friendly’s Ice Cream for $166 million in cash.

The sale gives Dean Foods, the nation’s leading producer of dairy milk and butter products, a top name in ice cream with the 81-year-old Friendly’s, which is based in Massachusetts. The ice cream and restaurant chain had fallen on tough times in the last few years, declaring bankruptcy in 2011 and closing scores of locations in the years to follow. 

“We are thrilled at the prospects the Friendly’s Ice Cream acquisition brings to Dean Foods,” Gregg Tanner, chief executive of Dean Foods, said in a statement. “The Friendly’s brand will be a catalyst in our strategy to grow our existing ice cream business and branded portfolio.” 

Dean operates over 50 regional brands, including Garelick Farms and Meadow Brook. The acquisition of Friendly’s, Tanner said, “fills a manufacturing and retail ice cream void in our nationwide footprint.” The retail chain, with more than 260 locations, will continue to be owned and operated by Sun Capital Partners, a private equity firm.  

Dean announced the news in advance of its first-quarter earnings, which saw the dairy giant beat Wall Street estimates by a large margin, posting earnings of 45 cents a share, compared with estimates of 38 cents a share. The company attributed the gains to low milk prices and higher margins.

Shares of Dean (NYSE:DF) were lately up slightly at $18.21.