NEW YORK (CBSNewYork/AP) — Longtime star Carlos Beltran has joined the New York Yankees as a special adviser.

His hiring came shortly before prized free agent Manny Machado was expected to meet with the Yankees on Wednesday. Beltran and Machado have the same agent.

Beltran spent nearly three seasons of his 20-year major league career with the Yankees. Popular and productive in pinstripes, he was dealt to Texas at the 2016 trade deadline.

Beltran played his last season in 2017 with the World Series champion Houston Astros, then was among the final candidates to manage the Yankees. After Aaron Boone was hired, Beltran said he turned down an adviser/assistant role with the team.

The 41-year-old Beltran also played for Kansas City, St. Louis, San Francisco and the New York Mets. The nine-time All-Star and three-time Gold Glove outfielder hit .279 overall with 435 home runs, 1,587 RBIs and 312 stolen bases.

Beltran is from Puerto Rico and donated $1 million to relief efforts on the island after the devastating effects of Hurricane Maria. He has continued to work on helping his homeland rebuild.

(© Copyright 2018 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)