You can try using Magento Plugin for enhancing existing functionality of any Abstract class, although the scope of the function should be Public.
Recently I worked on same issue where I need to exclude products having a custom attribute assigned from the Recently viewed product list.
I used plugin for the function named getItemsCollection from the class named Magento\Reports\Block\Product\AbstractProduct using the following syntax:
<plugin name="Package_Module::aroundGetItemsCollection" type="Package\Module\Block\Viewed" sortOrder="20"/>
public function afterGetItemsCollection(
$result = $result->addAttributeToFilter('skip_hire_product', [['neq' => 1], ['null' => true]], 'left');
You can use around as well as before plugins too.
Hope this work for you.