Here is the solution for rendering one field inside second's field template.
Get the first field value from hook_preprocess_field.
function teachervision_preprocess_file_field(&$variables) {
if ($variables['field_name'] == 'second_field_machine_name') {
$node = \Drupal::routeMatch()->getParameter('node');
$variables['first_field'] = '';
if ($node && isset($node->first_field_machine_name->value)) {
$variables['first_field'] = $node->first_field_machine_name->value;
}
}
}
Inside field template of second field, you can get this variable 'first_field' and do something like that
{% for item in items %}
<div{{ attributes.addClass(classes, 'field__first_item') }}>{{ first_field }}</div>
<div{{ attributes.addClass(classes, 'field__second_item') }}>{{ item.content }}</div>
{% endfor %}
Hope, it makes sense to you.