Using site controller returned variable in shared controller

If I define and return a variable $products in site.php controller…

controllers/site.php

return function ($site) {

    $products = $site->children()->listed()->filterBy('intendedtemplate','product'); 
    
    return compact('products');
}

Then I create a shared controller for my statistics.php template, how do I access $products?

controllers/statistics.php

return function ($site, $kirby) {

  $shared = $kirby->controller('site' , compact('site'));  

  // How to access $products here

  return a::merge($shared , compact('whatever'));
}

Thanks

$shared is now an array, as you would see if you dumped it with dump($shared) (or inspected it with a debugger).

Therefore, you can fetch the products from this array via the products key:

dump($shared['products']);

I see, of course, we are using a::merge in the end.

Thank you,