My question involves personal property located in the State of: California

So I was having a debate with my friend on the limits of trespassing in the state of CA.

Let's say Person A was given a key to an apartment that its friends are renting. Person A is not on the lease but helps pay rent. Under what circumstances would Person A be considered a trespasser? There are no signs in this apartment stating "No Trespassing." Thank you all for your time. If possible could you cite which law or code you use to backup the statement if not it's fine any guidance to look this up is a plus. I promise this isn't for school and it isn't me trying to get my homework done for me. Just an honest, curious debate that I want to win heh.