please try this
if ( have_posts() ) : while ( have_posts() ) : the_post();
if ( get_post_status (get_the_id()) == 'private' ) {
if ( current_user_can( 'administrator' ) ) {
the_title();
the_content();
} else if ( current_user_can( 'subscriber' ) ) {
the_title();
the_content();
} else {
echo 'this post is private';
}
} else {
the_title();
the_content();
}
endwhile;
endif;