Those who are friends for the sake of utility part when the advantage is at an end; for they were lovers not of each other but of profit.
For the sake of pleasure or utility, then, even bad men may be friends of each other, or good men of bad, or one who is neither good nor bad may be a friend to any sort of person, but for their own sake clearly only good men can be friends
 Aristotle, Nicomachean Ethics (c. 334 BC - 330 BC). copy citation

add
Author Aristotle
Source Nicomachean Ethics
Topic utility pleasure
Date c. 334 BC - 330 BC
Language English
Reference
Note Translated by W. D. Ross
Weblink http://classics.mit.edu/Aristotle/nicomachaen.mb.txt

Context

“but many lovers on the other hand are constant, if familiarity has led them to love each other's characters, these being alike. But those who exchange not pleasure but utility in their amour are both less truly friends and less constant. Those who are friends for the sake of utility part when the advantage is at an end; for they were lovers not of each other but of profit. For the sake of pleasure or utility, then, even bad men may be friends of each other, or good men of bad, or one who is neither good nor bad may be a friend to any sort of person, but for their own sake clearly only good men can be friends; for bad men do not delight in each other unless some advantage come of the relation. The friendship of the good too and this alone is proof against slander; for it is not easy to trust any one talk about a man who has long been tested by oneself;” source