Zero-Knowledge Proofs are effectively built to prove knowledge of data without revealing it. So what you ask is very possible indeed!
Let's say that we're going to use Schnorr's identification scheme (but tons of other ZKPs exist, you can research Fiat-Shamir, Feige, Guillou-Quisquater, Schnorr digital signature; and those are only the first ones. Now there are SNARKs used in ZCash blockchain etc.).
A and B both know userID, which is converted to some secret/private number x.
Both interact with a verifier to prove knowledge of userID. (g is a public generator for some group, and all this is done modulo some prime number, but for ease of read I won't put that here. You can look the wikipedia for schnorr's identitifation protocol)
They disclose the public key
y = g^x. Generate a random r, r' (for A and B respectively). Disclose
t = g^r and
t' = g^r'. [commitment step]
Verifier sends a number
c'. [challenge step]
s = r - cx. Verifier checks by computing
g^s y^c == t [response step]
g^s y^c = g^(r-cx) g^(cx) = g^r = t
Verifier is then convinced that A knows the secret key x, hence the userID.
Same for B:
s' = r' - c'x => g^s' y^c' = g^(r'-c'x) g^(c'x) = g^r' = t'.
Both entities A and B proved knowledge of userID without disclosing it.
Hope this helps :)
EDIT: I just tilted on the "owned" part. Here we prove knowledge of, not ownership. I imagine a server could send a unique token derived from the userID and send it to A, derive another to send to B (thanks to some salt). Both A and B would prove knowledge of these tokens, which have been issued by the server, so the server would effectively be convinced of their ownership of that data.
Just an idea in case the previous thoughts weren't really answering your question ^^