Check if user is in a group of another site within multisite network [closed]

Solved this with the following code:

<?php

    $blog_id = 1; //set the blog id to the main site id 

    switch_to_blog( $blog_id );

    $user_id = get_current_user_id();
    $group = Groups_Group::read_by_name( 'Premium' );
    if ( Groups_User_Group::read( $user_id, $group->group_id ) ) { 
        echo 'PREMIUM!!';
    } else {
        echo 'Not premium';
    }

    restore_current_blog();

?>