The first thing to consider when analyzing the friendship between Charley and Willy is that these two men belong to a completely different generation where the sense of community, responsibility, and loyalty could never be compared to modern day relationships.
Charley, a man who is obviously more knowledgeable, successful, and reasonable than Willy, is also mature enough to leave his own ego aside in order to, objectively, analyze Willy's situation for what it is. Throughout the play, Charley and his son Bernard have acted as foils to Willy and Biff, representing a more conventional and functional relationship between father and son. Since Charley is aware of how dysfunctional Willy's family actually is, he has come to the point of tolerating and helping Willy rather than to leave this sad man to his own devices.
Moreover, Charley is aware of Willy's jealousy toward him. It is a product of the changing times, the ideal of "keeping up with the Joneses". Yet, Charley does not let that go to his head. He does mention that to Willy as a way to "wake him up", but deep inside he would much rather help Willy shake off the fantasy world that he has created, and help him to do so financially.
Willy does not budge; he will not work for Charley because he is too proud. He does take his money, though, but this is because the dynamics between he and Charley have being going on for so long that now and he has become used to the idea of Charley coming to the rescue. Let's not forget that Willy is not completely in his proper mental state, so half of the time he may have been imagining something else taking place.
Therefore, the combination of pride, routine, loyalty, and the ever-changing times of Willy Loman has rendered him a man who depends entirely on his friend. Thankfully for Willy, he does have a true friend in Charley. Without Charley, Willy could not have survived the last days of his life.