How to make a page both “private” and “password protected”

Im really inexperienced with wordpress but i googled a few sec on google and maybe this will help.

function is_user_logged_in() {

    $user = wp_get_current_user();

 //Try to detect if the user is in a group here

    return $user->exists();

}

Maybe you can try to do something with the page if the user is detected as user and in what group it is.

Source: https://developer.wordpress.org/reference/functions/is_user_logged_in/