Look into switch_to_blog()
and its required follow up, restore_current_blog()
I left comments in code for basic idea to adapt into your function.
It may need tweaking, and can probably be improved.
//Site B
add_action( 'init', 'site_a_author_upload_site_b' );
function site_a_author_upload_site_b() {
if ( is_user_logged_in() ) {
//get a WP_User object of current user
$current_user = wp_get_current_user();
//ID of Site A
$site_a = 1;
//Switch to Site A
switch_to_blog( $site_a );
//get current user's roles on Site A
$get_role = $current_user->roles;
//Check if logged in user is an author on Site A
if ( in_array( 'author', $get_role ) ) {
//if yes, let's 1) restore current blog (Site B)
restore_current_blog();
//and 2) Add the cap we want to add to Wp_User object
$current_user->add_cap( 'upload_files' );
}
else {
//be sure we have restored current blog
restore_current_blog();
}
}//end if logged in
}//end site_a_author_upload_site_b()