Associate-with companions [object-を] see [if-ば], that person [subject-が] understand thing [copula-だ].
付き合う仲間 = 'the companions one associates with.' ~を見れば~がわかるものだ = 'if you look at X, you can understand Y (as a general truth).' ものだ marks this as a piece of received wisdom.