2FA would normally send an Allow prompt to a logged-in iOS device, and require the Mac user to enter the code that displays on the iOS device after logging in.
Your friend must be logging in to an Apple ID that hasn't been logged into an iOS device after the "trusted device" paradigm was put in place, or in a smaller realm of likelihood, active on any device in a certain time period. This then defaults 2FA to redirect to what presumably is an encrypted snapshot of the passcode of the device formerly logged into the Apple ID before the "trusted device" regime.
Just tell your friend to enter the likely correct 6-digit code and 2FA will snap to the Mac. iOS passcodes, your friend should keep in mind, are hardly silver bullets. If the whole world found out mine was 2222, uh, so what? You still have to achieve physical possession of my device. It's like hiding your debit card pin. Yawn.