If you're actively pushing, then both of you, with whoever happens to get it getting it. If a teamfight is potentially immenient, I'd be wary of using any non-trivial cds to CS with though. Still the goal there is to push the wave down to the tower/inhib/nexus, not necessarily to pick up cs gold.
If theres a big side wave and someone needs to go get it, then it's probably whoever can do it safely and isn't needed elsewhere. Sometimes this'll mean the more fed person get it (since it's unsafe for the other to try to get it), and other times it'll be the person who is behind (they need it more to come back, and the more fed person is needed wherever the teamfight/seige situation is). Other still time's you'll be in a situation where someone has demonstrated they can potentially carry the game, in which case letting them having all the resources can be wise. It's all very situational.
That said, in solo queue in practice it just ends up being whoever is closest, and that's probably fine in the grand scheme of things, as the lack of coordinated teamwork amongst the team is prone to be a far bigger factor than micromanaging the gold distribution.