In the work a cooperative game where distance or similarity of players may be defined is considered. A characteristic function is defined in such a way that it is high for such coalitions which consist of more similar objects than objects from other coalitions. We consider the function which may not be superadditive that is why not only the grand coalition but smaller ones can be formed and considering a game with coalitional structure is reasonable. Therefore, we have a natural transformation from a cooperative game to a clustering problem. Several single-valued cooperative solution concepts are considered with this type of a characteristic function and stability conditions are found.