The third parameter you can pass to get_the_post_thumbnail
is $attributes
, which you can use to pass custom HTML attributes including classes.
$thumbnail = get_the_post_thumbnail(
get_the_ID(), // Post ID.
'thumbnail', // Image size.
array( // Attributes
'class' => 'my-custom class-names', // Classes go here.
)
);
Note that this will override the default image classes that WordPress assigns (which is attachment-$size_class size-$size_class
)